-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] Lesson 저장 로직 구현 #17
Conversation
* chore: 외부통신을 위한 webflux의존성 추가 * feat: KAKAO API를 통해 메시지를 보내는 기능 구현 * feat: 시스템 시간 정의(Clock) * chore: firebase의존성 주입 * feat: fcm을 사용해 알람기능 구현 * feat: 이벤트 객체 정의(수업 생성) * feat: lessonid에 따른 객체 찾는 기능구현 * feat: 이벤트 객체 정의(수업 철회) * feat: 알람 기능 추상화 밑 스케줄러 기능 구현 * feat: Letter기능 및 알람 메시지 구현 * feat: 오후 **시 **분 형식으로 변경하는 메서드 구현 * feat: 알람기능 구현(수업신청, 수업철회) * feat: 알람기능의 필요한 스케줄 기능 추가 * chore: DB의존성 추가 * feat:서버가 재시작했을때 알림을 초기화해주는 기능구현 * feat: 알람 확인을 위한 프론트코드 구현 * feat: firebase 설정 추가 * feat: 알람 테스트를 위한 컨트롤러 작성 * feat: 스케쥴러 빈 등록 * feat: Redis를 활용하여 분산된서버일 때 중복으로 알람이 발생하는 문제 해결로직 작성 --------- Co-authored-by: yuseonjun <[email protected]>
private final UserRepository userRepository; | ||
|
||
public List<LessonResponse> findMemberShipsById(Long userId) { | ||
List<Lesson> lessons = lessonRepository.findByUserId(userId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final List<Lesson> lessons = lessonRepository.findByUserId(userId);
로 바꾸면 좋을거같아요!
public List<ProductResponse> findMemberShipsById(Long userId) { | ||
List<Product> products = productRepository.findByUserId(userId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파라미터랑 products에 final 키워드 붙혀주세요
List<Product> findAll(); | ||
List<Product> findByUserId(Long userId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
둘다 없애도될거같아요!
findByUserId는 UserRepository에서 가져오고 findAll은 정의되있어서요..
private final LessonService lessonService; | ||
|
||
@PostMapping("/save") | ||
public ResponseEntity<Void> save(final Long userId, @RequestBody LessonResponse lessonResponse) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LessonResponse로 받는 이유가 뭔가요?..
LessonRequest를 정의해서 하는게 좋아보여요
private ResponseEntity<List<ProductResponse>> findMemberShipsById(@PathVariable Long userId) { | ||
List<ProductResponse> response = productService.findMemberShipsById(userId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final~
public static LessonResponse from(Lesson lesson) { | ||
return new LessonResponse(lesson.getId(), lesson.getMemberShip(), lesson.getStudent(), | ||
lesson.getTeacher(), lesson.getStartedAt(), lesson.getEndedAt(),lesson.getRecord()); | ||
} | ||
|
||
public static List<LessonResponse> fromList(List<Lesson> lessons) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final~
public static ProductResponse from(Product product) { | ||
return new ProductResponse(product.getId(), product.getType(), product.getTeacher(), | ||
product.getCount(), product.getCreatedAt(), product.getUpdatedAt()); | ||
} | ||
|
||
public static List<ProductResponse> fromList(List<Product> products) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final~
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
개행 지워주면 좋을거같아요.
private final MemberShipRepository memberShipRepository; | ||
|
||
@Transactional | ||
// request 받아서 save 하는 로직 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
주석도 지우면 좋을거같아요!
private final LessonService lessonService; | ||
@PostMapping("/save/{membershipId}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
중간에 개행해주세요!
6c42d00
to
63cbc46
Compare
|
||
private String record; | ||
|
||
public Lesson(Long id, MemberShip memberShip, LocalDateTime startedAt, LocalDateTime endedAt, String record) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정적 팩토리 메서드를 사용하실거면 private로 감추는것도 좋아보여요!
private final LessonService lessonService; | ||
|
||
@PostMapping("/save/{membershipId}") | ||
public Long save(final @PathVariable Long membershipId, final @RequestBody LessonRequest lessonRequest) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final을 어노테이션 오른쪽에 놔두면 좋을거 같아요!
LocalDateTime endedAt, | ||
String record | ||
) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
공백을 지우는건 어떨까요?
관련 이슈
설명
startedAt, endedAt, record를 요청받아 membership과 함께 lessonRepo에 저장